


import pymysql

# from util.g import g

# POOL = g.hitech_pool
#
# dict_cursor = g.dict_cursor
from DBUtils.PooledDB import PooledDB

from settings import online_config


class g():
    logger = None
    dict_cursor = pymysql.cursors.DictCursor

    hitech_pool = PooledDB(
        creator=pymysql,
        maxconnections=6,
        mincached=0,
        maxcached=5,
        maxshared=3,
        blocking=True,
        maxusage=None,
        setsession=[],
        ping=2,
        host=online_config.get("host"),
        port=online_config.get("port"),
        user=online_config.get("user"),
        password=online_config.get("password"),
        charset=online_config.get("charset"),
        database="hitech"
    )

POOL = g.hitech_pool
dict_cursor = g.dict_cursor